<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>城市信息列表</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4,initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcuticon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="/ringspace-web/manager/css/font.css">
<link rel="stylesheet" href="/ringspace-web/manager/css/xadmin.css">
<script type="text/javascript" src="/ringspace-web/manager/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="/ringspace-web/manager/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="/ringspace-web/manager/js/xadmin.js"></script>
<script src="/ringspace-web/manager/lib/layui/lay/modules/table.js" charset="utf-8"></script>
</head>
<body>
	<!-- 导航栏 -->
	<div class="x-nav">
		<span class="layui-breadcrumb"> <a href="">运营总部</a> <a href="">城市管理</a>
			<a> <cite>城市列表</cite></a>
		</span> <a class="layui-btn layui-btn-small"
			style="line-height: 1.6em; margin-top: 3px; float: right"
			href="javascript:location.replace(location.href);" title="刷新"> <i
			class="layui-icon" style="line-height: 30px">ဂ</i></a>
	</div>
	
	<!-- 页面内容 -->
	<div class="x-body">
		<div class="layui-row">
			<form class="layui-form layui-col-md12 x-so">
				<input type="text" name="cityProvince" placeholder="请输入所属省份名称"
					autocomplete="off" class="layui-input">
				<button class="layui-btn" lay-submit="" lay-filter="sreach">
					<i class="layui-icon">&#xe615;</i>
				</button>
			</form>
		</div>
		<xblock>
		<button class="layui-btn"
			onclick="x_admin_show('添加用户','/ringspace-web/manager/html/operation/city/city-add.html')">
			<i class="layui-icon"></i>添加
		</button>
		
		
		<!-- 城市信息列表 -->
		<table class="layui-table" lay-data="{url:'/ringspace-web/city/loadFirst',page:true,limit:'5'}" lay-filter="demo">
			<thead>
				<tr>
					<th lay-data="{field:'cityId',width:200}">城市ID</th>
					<th lay-data="{field:'cityName',width:250}">城市名称</th>
					<th lay-data="{field:'cityPerson',width:300}">联系人</th>
					<th lay-data="{field:'cityNumber',width:300}">联系方式</th>
					<th lay-data="{field:'cityProvince',width:300}">所属省份</th>
					<th lay-data="{fixed: 'right', width:300, align:'center', toolbar: '#barDemo'}">操作</th>
				</tr>
			</thead>
		</table>
	</div>
	<script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-mini" lay-event="edit">编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-mini" lay-event="del">删除</a>
    </script>
   

 
<script>
layui.use('table', function(){
  var table = layui.table;
  //监听表格复选框选择
  table.on('checkbox(demo)', function(obj){
    console.log(obj)
  });
  //监听工具条
  table.on('tool(demo)', function(obj){
    var data = obj.data;
    if(obj.event === 'detail'){
      layer.msg('ID：'+ data.id + ' 的查看操作');
    } else if(obj.event === 'del'){
      layer.confirm('真的删除行么', function(index){
        obj.del();
        window.location.href="/ringspace-web/city/deleteCity?cityId="+data.cityId;
        layer.close(index);
      });
    } else if(obj.event === 'edit'){
    	window.location.href="/ringspace-web/city/getCity?cityId="+data.cityId;
    }
  });
  
  var $ = layui.$, active = {
    getCheckData: function(){ //获取选中数据
      var checkStatus = table.checkStatus('idTest')
      ,data = checkStatus.data;
      layer.alert(JSON.stringify(data));
    }
    ,getCheckLength: function(){ //获取选中数目
      var checkStatus = table.checkStatus('idTest')
      ,data = checkStatus.data;
      layer.msg('选中了：'+ data.length + ' 个');
    }
    ,isAll: function(){ //验证是否全选
      var checkStatus = table.checkStatus('idTest');
      layer.msg(checkStatus.isAll ? '全选': '未全选')
    }
  };
  
  $('.demoTable .layui-btn').on('click', function(){
    var type = $(this).data('type');
    active[type] ? active[type].call(this) : '';
  });
});
</script>
<script>
		layui.use('table', function(){
			var table = layui.table;

		});

		layui.use(['laypage', 'layer'], function(){
			var laypage = layui.laypage
			,layer = layui.layer;
 
			/*//完整功能
		     laypage.render({
		   	elem: 'demo7'
		   	,count: 100
		   	,layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
		   	,jump: function(obj){
		   		console.log(obj)
		   	}
		   });  */

		});
    </script>
</body>

</html>